<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="mainMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="0" />
<title>用户部门</title>
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script>
	$(document).ready(function() {
		var deptSet =  $("#depSet").val();
		if(null==deptSet){
			alert("请添加部门,再继续操作...");
			$("#submitBtn").attr("disabled","disabled");
		}
		
		$("input[name='startDate']").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				maxDate : '#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}',
				dateFmt : 'yyyy-MM-dd'
			});
		});
		$("input[name='endDate']").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '#F{$dp.$D(\'startDate\')}',
				dateFmt : 'yyyy-MM-dd'
			});
		});
		$("#username").focus();
		$("#inputForm").validate({
			rules:{
				"user.name":{
					required:true,
				},
				startDate:{
					required:true,
				},
				endDate:{
					required:true,
				},
				"user.email":{
					required:true,
					email:true,
					remote:"${ctx}/project/sign/org/userdepartment!checkEmail.action?oldEmail=${user.email}",
				}
			},
			messages:{
				"user.name":{
					required:"必须输入用户名：",
				},
				startDate:{
					required:"必须选择开始时间！",
				},
				endDate:{
					required:"必须选择结束时间！",
				},
				"user.email":{
					required:"必须输入邮箱！",
					email:"请输入正确格式的邮箱！",
					remote:"该邮箱已被使用！",
				}
			}
		});
	});
</script>
</head>
<body>
<form action="userdepartment!save.action" method="post" class="yform"
	id="inputForm"><input type="hidden" name="id" value="${id}" />
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul
	class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all ui-sortable">
	<li><a id="build"
		class="ui-state-default ui-corner-top "
		href="${ctx}/project/sign/org/user!input.action?id=${user.id}&deptId=${deptId}&projectId=${projectId}&typeId=${typeId}&organizationId=${organizationId}&userdeptId=${id}">人员信息</a></li>
	<li><a id="design" class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active "
		href="#">部门信息</a></li>
	<li><a class="ui-state-default ui-corner-top "
		href="${ctx}/project/sign/org/userqualification.action?deptId=${deptId}&projectId=${projectId}&typeId=${typeId}&organizationId=${organizationId}&userdeptId=${id}&userId=${user.id}">人员资质</a></li>
</ul>
<table class="noborder">
	<tr class="type-text">
	    <td>部门名称</td>
		<td><pt:labels type="dept" name="deptSet" argument1="${empty (param.deptId)?(organizationId):(param.deptId)}" argument2="${typeId}"
			toScope="request" ></pt:labels> 
			<s:select id="depSet" list="#request.deptSet" emptyOption="请选择"  listKey="value"  listValue="label" name="dept.id"></s:select>
		</td>
		<td>职务</td>
		<td><input type="text" value="${officalPosition}"
			name="officalPosition" />
			<input type="hidden"  name="projectId" value="${projectId}"/>
			<input type="hidden"  name="organizationId" value="${organizationId}"/>
			<input type="hidden"  name="typeId" value="${typeId}"/>
			<input type="hidden"  name="deptId" value="${deptId}"/>
			</td>
	</tr>
	<tr class="type-text">
		<td>开始时间</td>
		<td><input type="text" readonly="readonly" id="startDate"
			name="startDate" value="${startDate}" /></td>
		<td>结束时间</td>
		<td><input type="text" readonly="readonly" id="endDate"
			name="endDate" value="${endDate}" /></td>
	</tr>
	<tr class="type-text">
		<td>备注</td>
		<td><textarea rows="5" cols="60" name="remark">${remark }</textarea>
		</td>
	</tr>
</table>
</div>
<div class="type-button"><input id="submitBtn"   type="submit"
class="submit" value="提交"  />&nbsp;<input
	  type="button" value="关闭" class="reset"
	onclick="_cloBtn();" /> </div>
</form>
</body>
</html>